package com.ccrfid.rmc6.lbservice3.mq;

import java.util.StringJoiner;

//阅读器/定位器在线状态
//查询topic ccms_query_status
//获取topic mp_devices_status
public class MqDevStatus {
    public static final int TYPE_LOCATOR = 1;
    public static final int TYPE_READER = 2;
    public static final int ONLINE = 1;
    public static final int OFFLINE = 2;

    private Integer id;
    private Integer devType;
    private Long time;
    private Integer msg;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getDevType() {
        return devType;
    }

    public void setDevType(Integer devType) {
        this.devType = devType;
    }

    public Long getTime() {
        return time;
    }

    public void setTime(Long time) {
        this.time = time;
    }

    public Integer getMsg() {
        return msg;
    }

    public void setMsg(Integer msg) {
        this.msg = msg;
    }

    public boolean isLocator() {
        return devType.equals(TYPE_LOCATOR);
    }

    public boolean isReader() {
        return devType.equals(TYPE_READER);
    }

    public boolean isOnline() {
        return msg.equals(ONLINE);
    }

    public boolean isOffline() {
        return msg.equals(OFFLINE);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", MqDevStatus.class.getSimpleName() + "[", "]")
                .add("id=" + id)
                .add("devType=" + devType)
                .add("time=" + time)
                .add("msg=" + msg)
                .toString();
    }
}
